<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>

    <div class="box">
        <div>{{msg1}}</div>
        <input type="text" v-model='msg1' @keyup.a='submit'>
    </div>
    <script>
        //把自定义按键 和 对应键码联系起来
        Vue.config.keyCodes.a = 65
        var vm = new Vue({
            el: '.box',
            data: {
                msg1: ''
            },
            methods: {
                submit() {
                    console.log('a键成功')
                }
            }
        })
    </script>
</body>

</html>